﻿using System;
using System.IO;
using System.Reflection;
using log4net;
using log4net.Config;

namespace SportTraining.Helpers
{
    public static class Logger
    {
        public static ILog Log {get; set;}

        static Logger()
        {
            string appName = typeof (App).Namespace;
            GlobalContext.Properties["PathByUser"] = string.Format("{0}\\{1}", Environment.GetFolderPath(Environment.SpecialFolder.Personal), appName);

            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("{0}.log4net.config", appName));
            XmlConfigurator.Configure(stream);

            Log = LogManager.GetLogger(typeof(Logger));
        }
    }
}